import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router";
// 异步组件
import { defineAsyncComponent } from 'vue'
const home = defineAsyncComponent(() => import('../pages/home/index.vue'))
const about = defineAsyncComponent(() => import('../pages/about/index.vue'))
const serve = defineAsyncComponent(() => import('../pages/serve/index.vue'))
const newsList = defineAsyncComponent(() => import('../pages/news/list.vue'))
const newsDetail = defineAsyncComponent(() => import('../pages/news/detail.vue'))
const routes: Array<RouteRecordRaw> = [
  {
    path: "/",
    name: "Home",
    component: home
  },
  {
    path: "/about",
    name: "About",
    component: about
  },
  {
    path: "/serve",
    name: "Serve",
    component: serve
  },
  {
    path: "/news/detail",
    name: "newsDetail",
    component: newsDetail
  },
  {
    path: "/news/list",
    name: "newsList",
    component: newsList
  }

]
export default createRouter({
  history: createWebHashHistory(),
  routes
})